package io.gitee.yth.design.pattern.test.core.pattern.behavioral.state;

/**
 * @author yth
 * @since 2023-05-03-0:31
 */
public class TCPClosed extends AbstractTCPState {

    private static final TCPClosed instance = new TCPClosed();

    public static TCPClosed getInstance() {
        return instance;
    }

    private TCPClosed() {
    }

    @Override
    public void activeOpen(TCPConnection tcpConnection) {
        System.out.println("activeOpen ...");
        // send SYN, receive SYN, ACK, etc.
        changeState(tcpConnection, TCPEstablished.getInstance());
    }

    @Override
    public void passiveOpen(TCPConnection tcpConnection) {
        System.out.println("passiveOpen ...");
        changeState(tcpConnection, TCPListen.getInstance());
    }
}
